package com.seetools.generator.execute;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.*;
import com.seetools.generator.config.*;

/**
 * @Author: seeTools
 * @Date: 2023/5/18  16:58
 * @Version 1.0
 */
public class GeneratorMain {

    /**
     * 数据库表名字 每次需要自动生成修改改字段即可
     */
    private static final String TABLE_NAME = "subscribe_task_store";

    public static void main(String[] args) {
        GlobalConfig globalConfig = GlobalInitConfig.globalInit();
        DataSourceConfig dataSourceConfig = SqlInitConfig.sqlInit();
        PackageConfig packageConfig = PackageInitConfig.packageInit();
        StrategyConfig strategyConfig = StrategyInitConfig.strategyInit(TABLE_NAME);
        TemplateConfig templateConfig = TemplateInitConfig.templateInit();
        // 代码生成器
        AutoGenerator mpg = new AutoGenerator();
        mpg.setGlobalConfig(globalConfig);
        mpg.setDataSource(dataSourceConfig);
        mpg.setPackageInfo(packageConfig);
        mpg.setStrategy(strategyConfig);
        mpg.setTemplate(templateConfig);
        mpg.execute();
    }

}
